// Definition for a binary tree node.
function TreeNode(val, left, right) {
  this.val = val === undefined ? 0 : val;
  this.left = left === undefined ? null : left;
  this.right = right === undefined ? null : right;
}
function createTree(arr) {
  if (!arr.length) return null;
  const nodeList = [];
  for (let i = 0; i < arr.length; i++) {
    let node;
    if (!arr[i]) {
      node = null;
    } else {
      node = new TreeNode(arr[i]);
    }
    nodeList.push(node);
  }
  for (let i = 0; i < nodeList.length; i++) {
    if (2 * i + 1 < nodeList.length) {
      nodeList[i].left = nodeList[2 * i + 1];
    }
    if (2 * i + 2 < nodeList.length) {
      nodeList[i].right = nodeList[2 * i + 2];
    }
  }
  return nodeList[0];
}
/**
 * @param {TreeNode} root
 * @param {number} key
 * @return {TreeNode}
 */
var deleteNode = function (root, key) {};
let root = [5, 3, 6, 2, 4, null, 7],
  key = 3;
console.log(deleteNode(createTree(root), key));
// (root = []), (key = 0);
// console.log(deleteNode(createTree(root), key));
